package web;


import java.io.IOException;
import java.util.Date;
import javax.servlet.ServletException;
        import javax.servlet.http.HttpServlet;
        import javax.servlet.http.HttpServletRequest;
        import javax.servlet.http.HttpServletResponse;

public class HttpServletDemo extends HttpServlet{
    private static final long serialVersionUID = 1L;
    /* 对应form表单的get请求方式
     * HttpServletRequest：请求对象
     * HttpServletResponse：响应对象
     */
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //写具体实现的地方  -  service()
        resp.getWriter().println(new Date());
    }
}


